    let btnxs = document.getElementById('xs')
    let btnds = document.getElementById('ds')
    let spanall = document.querySelectorAll('#pintu>span')
    let n = 0
    let arr = [
        ['0000', '0101', '0202', '0303', '0404'],
        ['0510', '0611', '0712', '0813', '0914'],
        ['1020', '1121', '1222', '1323', '1424'],
        ['1530', '1631', '1732', '1833', '1934'],
        ['2040', '2141', '2242', '2343', '2444']
    ]
    spanall[24].style.display = 'none'
    for (let i = 0; i < arr.length; i++) {
        for (let j = 0; j < arr[i].length; j++) {
            let ab = Number(arr[i][j].substr(0, 2))
            let c = Number(arr[i][j].substr(2, 2).substr(0, 1)) * 80
            let d = Number(arr[i][j].substr(3)) * 80
            spanall[ab].style.top = c + 'px'
            spanall[ab].style.left = d + 'px'
            spanall[ab].style.backgroundPositionY = -c + 'px'
            spanall[ab].style.backgroundPositionX = -d + 'px'
        }
    }

    for (let i = 0; i < spanall.length; i++) {
        spanall[i].onclick = function () {
            let t24 = parseInt(spanall[24].style.top)
            let l24 = parseInt(spanall[24].style.left)
            let ti = parseInt(spanall[i].style.top)
            let li = parseInt(spanall[i].style.left)
            let juli = Math.abs(t24 - ti) + Math.abs(l24 - li)
            if (juli == 80) {
                bianhuan(i, 24)
                console.log(i);
            }
        }
    }

    btnxs.onclick = function () {
        n++
        for (let i = 0; i < spanall.length; i++) {
            if (n % 2 == 0) {
                spanall[i].innerText = ""
            } else {
                spanall[i].innerText = i + 1
            }
        }
    }
    btnds.onclick = function () {
        for (let i = 0; i < 20; i++) {
            let x = Math.floor(Math.random() * (25));
            let y = Math.floor(Math.random() * (25));
            bianhuan(x, y)
        }
    }

    function bianhuan(x, y) {
        let a = spanall[y].style.top
        let b = spanall[y].style.left
        spanall[y].style.top = spanall[x].style.top
        spanall[y].style.left = spanall[x].style.left
        spanall[x].style.top = a
        spanall[x].style.left = b
    }